﻿/*
AwpAdmin, an admin tool for Battlefield 3
Copyright (C) 2011 agentwite, Timi, Unseen, AlCapwn

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

You can contact us at http://bf3admin.codeplex.com/.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace AwpAdminTool
{
    /// <summary>
    /// Contains information on a <see cref="Plugin"/>.
    /// </summary>
    public class PluginInfo : MarshalByRefObject
    {
        string _FolderName;
        /// <summary>
        /// Gets the location of the <see cref="Plugin"/>.
        /// </summary>
        /// <value>The folder name of the <see cref="Plugin"/>.</value>
        public string FolderName { get { return _FolderName; } }

        XElement Info;
        /// <summary>
        /// Gets the name of the <see cref="Plugin"/>.
        /// </summary>
        /// <value>The name of the <see cref="Plugin"/>.</value>
        public string Name { get { return Info != null ? Info.Element("name").Value : ""; } }

        /// <summary>
        /// Gets the description of the <see cref="Plugin"/>.
        /// </summary>
        /// <value>The description of the <see cref="Plugin"/>.</value>
        public string Description { get { return Info != null ? Info.Element("description").Value : ""; } }

        /// <summary>
        /// Gets the publisher of the <see cref="Plugin"/>.
        /// </summary>
        /// <value>The publisher of the <see cref="Plugin"/>.</value>
        public string Publisher { get { return Info != null ? Info.Element("publisher").Value : ""; } }

        /// <summary>
        /// Gets the website of the <see cref="Plugin"/>.
        /// </summary>
        /// <value>The website of the <see cref="Plugin"/>.</value>
        public string Website { get { return Info != null ? Info.Element("website").Value : ""; } }

        internal PluginInfo(string path, XElement info)
        {
            _FolderName = path;
            Info = info;
        }
    }
}
